const sql = require("../../../config/web-question-config");

// 获取所有classify
function getClassify() {
  return sql("select * from classify");
}

// 获取单个classify
function getOneClassify(arr) {
  return sql("select * from classify where classify_id = ?", arr);
}

// 添加classify
function addClassify(arr) {
  console.log(arr);
  return sql("insert into classify value (NULL,?,?,?,1,?)", arr);
}

// 更新classify
function updateClassify(arr) {
  return sql(
    "update classify set title=?,src = ? , atime = ? where classify_id = ?",
    arr
  );
}

// 删除classify
function deleteClassify(arr) {
  return sql("delete from classify  where classify_id = ?", arr);
}

// 是否展示classify
function showClassify(arr) {
  return sql("update classify set isShow = ? where classify_id = ?", arr);
}

module.exports = {
  getClassify,
  getOneClassify,
  addClassify,
  updateClassify,
  deleteClassify,
  showClassify,
};
